a=int (input())
print(a%5)